package dao

import (
	"WORKSPACE/models"
	"fmt"
)

func GetAllemployess() (error, []models.Employess, int64) {
	var EmployesstData []models.Employess
	//AttendanceData := []models.Attendance{{"1qwe",1,"1",1,1,1,1,1,}}
	var total int64
	fmt.Println(EmployesstData)
	err := db.Table("employess").Order("Eno ASC").Count(&total).Find(&EmployesstData).Error
	fmt.Println(EmployesstData)
	return err, EmployesstData, total
}

func Addemployess(employess models.Employess) error {
	err := db.Table("employess").Create(&employess).Error
	return err
}

func Updateemployess(employess models.Employess) error {
	err := db.Table("employess").Where("Eno = ?", employess.Eno).Updates(employess).Error
	return err
}

func Delemployess(eno string) error {
	err := db.Table("employess").Where("Eno = ? ", eno).Delete(models.Attendance{}).Error
	return err
}